package providerConsume;

import java.util.concurrent.BlockingQueue;

public class Consume implements Runnable{
	
	private BlockingQueue<Data> queue;

	public Consume(BlockingQueue<Data> queue) {
		this.queue = queue;
	}


	@Override
	public void run() {
		while (true) {
			try {
				Data data = queue.take();
				System.out.println("消费线程："+Thread.currentThread().getName()+",消费数据："+data.getId());
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	}
	

}
